const Core = require('@alicloud/pop-core');


var client = new Core({
    accessKeyId: 'LTAI4FpK8yQKtUz3cerzcS4N',
    accessKeySecret: 'Yu0C7lS9igP74flLMHnhR7HyGMaNci',
    endpoint: 'https://dysmsapi.aliyuncs.com',
    apiVersion: '2017-05-25'
  });

  var requestOption = {
    method: 'POST'
  };


function sendSms(obj = {phone: '', params: {}, succ: () =>{}, err: () =>{}}) {
    var data = {
    "RegionId": "cn-hangzhou",
    "SignName": "�~J海�~V��~[��~Y~E�~M~Z�~H中�~C",
    "TemplateCode": "SMS_175175420",
    "PhoneNumbers": obj.phone,
    "TemplateParam": JSON.stringify(obj.params)
  }
    console.log(`data-----${JSON.stringify(data)}`)
    client.request('SendSms', data, requestOption).then((result) => {
        console.log(JSON.stringify(result));
        // succ(JSON.stringify(result))
      }, (ex) => {
        console.log(ex)
	//err(ex)
      })
}

export {sendSms}


